<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
</head>
<body>
<%
    //为了下面的value能拿到值，这里要提升值的作用域
    String username="";
    String password="";
    String ck="";
    //获取之前根目录下存储的所有cookie
    Cookie[] cookies = request.getCookies();
    if(cookies!=null && cookies.length>0){
        //遍历数组，逐一和拿key和标签的属性名对比
        for (Cookie cookie : cookies) {
            if("username".equals(cookie.getName())){
                //名字对上了，就把值赋给这个遍变量
                username=cookie.getValue();
                //再给复选款属性赋值
                ck="checked";
            }
            if("password".equals(cookie.getName())){
                //名字对上了，就把值赋给这个遍变量
                password=cookie.getValue();
                //再给复选款属性赋值
                ck="checked";
            }
        }
    }
%>
<form action="${pageContext.request.contextPath}/studentServlet/login" method="post">
    学生姓名<input  type="text" name="username" value="<%=username%>"><br>
    学生密码<input  type="text" name="password" value="<%=password%>"><br>
    记住密码<input type="checkbox"  name="ck"  value="1" <%=ck%>><br>
    <button type="submit" value="">登录</button><br>
    <button type="submit" value="">注册</button><br>
</form>
</body>
</html>